package com.sdkj.recruit.controller;


import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.sdkj.recruit.service.ISmallNoManagementService;
import com.sdkj.recruit.vo.SimpleModelVo;
import com.sdkj.recruit.vo.SmallNoLogVo;
import com.sdkj.recruit.vo.SmallNoStatisticVo;
import com.sdkj.recruit.vo.SmallNoTaskVo;
import com.sdkj.recruit.vo.SmallNoVo;



/**
 * 小号控制
 * @author chenxiaozhong
 *
 */
@Controller
@Path("/smallNo")
public class SmallNoManagementController {

	@Autowired
	private ISmallNoManagementService smallNoService;

	/**
	 * 小号信息统计
	 * 
	 * @param currentPage
	 * @param pageSize
	 * @param smallNoName
	 * @param platformName
	 * @param request
	 * @return
	 */
	@GET
	@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
	@Path("/querySmallNoList")
	public SimpleModelVo querySmallNoList(@QueryParam("currentPage") final int currentPage,
			@QueryParam("pageSize") final int pageSize, @QueryParam("smallNoName") final String smallNoName,
			@QueryParam("platformName") final String platformName, @Context final HttpServletRequest request) {

		SimpleModelVo vo = new SimpleModelVo();

		List<SmallNoStatisticVo> list = smallNoService.querySmallNoList(currentPage, pageSize, smallNoName,platformName);
		long count = smallNoService.queryMerchantCount(currentPage, pageSize, smallNoName, platformName);
		vo.setCount(count);
		vo.setSmallNoList(list);
		return vo;
	}

	/**
	 * 小号注册
	 * 
	 * @param smallNoVo
	 * @param request
	 * @return
	 */
	@POST
	@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
	@Path("/saveSmallNo")
	public boolean saveSmallNo(final SmallNoVo smallNoVo, @Context final HttpServletRequest request) {
		return smallNoService.saveSmallNo(smallNoVo);
	}

	/**
	 * 小号登陆日志
	 * 
	 * @param merchantVo
	 * @param request
	 * @return
	 */
	@POST
	@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
	@Path("/saveSmallNoLog")
	public boolean saveSmallNoLog(final SmallNoLogVo smallNoLog, @Context final HttpServletRequest request) {

		return smallNoService.saveSmallNoLog(smallNoLog);
	}
	
	/**
	 * 保存小号任务
	 * @param smallNoTaskVo
	 * @param request
	 * @return
	 */
	@POST
	@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
	@Path("/smallNoTask")
	public boolean saveSmallNoTask(/*final SmallNoTaskVo smallNoTaskVo,*/ @Context final HttpServletRequest request) {
		
		SmallNoTaskVo vo = new SmallNoTaskVo();
		vo.setTaskName("小号任务");
		vo.setMerchantId("20170515144125025077y85k");
		vo.setSmallNoId("20170515151140040487mpsm");
		return smallNoService.saveSmallNoTask(vo);
	}
	

}
